package com.hw.paltfrom.controller.banlist;

import com.hw.paltfrom.pack.ResponseResult;
import com.hw.paltfrom.rescode.HWSystemCode;
import com.hw.paltfrom.service.banlist.BlacklistDriverServer;
import com.hw.paltfrom.utils.VerifyUtil;
import com.hw.paltfrom.vo.BlacklistDriverDetailsVO;
import com.hw.paltfrom.vo.BlacklistDriverVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
/**
 * 驾驶员黑名单管理
 * 梁天
 * 2019/11/06
 *
 **/
@RestController
@RequestMapping(value = "/HwBlacklistDriverController")
public class BlacklistDriverController {


    @Autowired
    private BlacklistDriverServer blacklistDriverServer;

    /**
     * 分页+精确查询
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/queryAllList")
    public Map<String, Object> queryAllList(@RequestParam HashMap<String, Object> vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return blacklistDriverServer.queryAllList(vo);
    }


    /**
     * 添加
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/add")
    public Map<String, Object> add(BlacklistDriverVO vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return blacklistDriverServer.insert(vo);
    }


    /**
     * 更新
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/update")
    public Map<String, Object> update(BlacklistDriverVO vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return blacklistDriverServer.update(vo);
    }



    /**
     * 分页+详情查询
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/queryDetailsList")
    public Map<String, Object> queryDetailsList(@RequestParam HashMap<String, Object> vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return blacklistDriverServer.queryDetailsList(vo);
    }



    /**
     * 添加详情
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/addDetails")
    public Map<String, Object> addDetails(BlacklistDriverDetailsVO vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return blacklistDriverServer.insertDetails(vo);
    }






}
